Skip to content

fix(common): pass freeform genres through to SDK instead of reverting to Electronic#14479

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/freeform-genre-adapter
Jun 16, 2026
Merged

fix(common): pass freeform genres through to SDK instead of reverting to Electronic#14479
dylanjeffers merged 1 commit into
mainfrom
fix/freeform-genre-adapter

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Problem

When an artist enters a freeform/custom genre on the track edit/upload form, it silently reverts to Electronic after saving.

Root cause

toSdkGenre in packages/common/src/adapters/track.ts filtered out any value not in the canonical Genre enum and returned undefined. That undefined then fell back to DEFAULT_GENRE = Genre.Electronic before being sent to the SDK:

// before
return VALID_GENRES.has(value) ? value : undefined   // custom genre → undefined → Electronic

This is the last missing piece of the freeform-genres feature. The backend already accepts any non-empty genre string up to 100 chars:

…but the web write-path adapter still corrupted custom genres to Electronic, so the feature wasn't actually live end-to-end on web.

Fix

Pass any non-empty genre string through unchanged. The empty case still falls back to Electronic (genre is required). Removes the now-unused VALID_GENRES set and adds regression tests.

Note

Re-applies the fix from #14465, which was closed inadvertently after the backend half merged — there was no superseding PR and main still had the bug.

Validation

  • tsc --noEmit — no new errors (one pre-existing unrelated Event.ts error remains on main)
  • eslint — clean
  • vitest src/adapters/track.test.ts — 5/5 pass (added 3 regression tests: freeform passthrough, canonical preserved, empty → Electronic)

🤖 Generated with Claude Code

… to Electronic

toSdkGenre in the track adapter filtered out any value not in the canonical
Genre enum and returned undefined, which then fell back to DEFAULT_GENRE
(Electronic) before reaching the SDK. As a result, custom/freeform genres
entered by artists were silently lost on save, even though the API, ETL
indexer, and SDK upload schema all already accept any non-empty string up to
100 chars.

Now any non-empty genre string is passed through unchanged; the empty case
still falls back to Electronic (genre is required). Removes the now-unused
VALID_GENRES set and adds regression tests.

Re-applies the fix from #14465, which was closed inadvertently after the
backend half (go-openaudio #351) merged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 103f980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@audius/common Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14479.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers dylanjeffers merged commit 272b8db into main Jun 16, 2026
13 checks passed
@dylanjeffers dylanjeffers deleted the fix/freeform-genre-adapter branch June 16, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant